﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Server_Code.Model.Processing;
using Server_Code.Model;

namespace Server_Code.WebService
{
    /// <summary>
    /// Summary description for Emergency
    /// </summary>
    [WebService(Namespace = "http://thanhphuongshop.com/mdc2011/Webservice/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WSEmergency : System.Web.Services.WebService
    {

        [WebMethod]
        public bool Add(string phonenumber,string longitude,string latitude,string message)
        {
            //return String.Format("{0}",a+b);

            
            int id = CEmergency.GetMaxId();
            DateTime time = DateTime.Now;
            Emergency emergency = CEmergency.New(id, phonenumber, longitude, latitude, message, time, 1);
            if (CEmergency.Add(emergency))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
